#ifndef DATASENDER_H
#define DATASENDER_H

#include <QObject>
#include <QUdpSocket>
#include <QHostAddress>

class DataSender : public QObject
{
    Q_OBJECT
public:
    explicit DataSender(QObject *parent = nullptr);
    
    void setDestination(const QString &ip, quint16 port);
    void setDestination(const QHostAddress &address, quint16 port);
    
signals:
    void errorOccurred(const QString &errorString);
    
public slots:
    void sendData(const QByteArray &data);
    
private:
    QUdpSocket m_socket;
    QHostAddress m_destAddress;
    quint16 m_destPort;
    QMutex m_mutex;
};

#endif // DATASENDER_H
